function [ adjList ] = createAdjacencyList( topologyInfo, numberOfVertices, numberOfFaces )
kMaxAdj = 20;
adjList = zeros(numberOfVertices, kMaxAdj);

for iVertex = 1:numberOfVertices
    for iFace = 1:numberOfFaces
        for i=1:3
            if (topologyInfo(iFace,i) == iVertex)
                % add iFace as adjacent to the vertex iVertex
                index = 1;
                while(index <= kMaxAdj)
                    if (adjList(iVertex, index)== 0)
                        adjList(iVertex, index) = iFace;
                        index = kMaxAdj + 1;
                    elseif (adjList(iVertex, index) == iFace)
                        index = kMaxAdj + 1;
                    else
                        index = index + 1; 
                    end
                end%while
            end%if
        end
    end%for faces
end%for

end%function




